import React from 'react'
import FixedSizeList from './FixedSizeList'

function Item({style, index}) {
    return (
        <div 
            className='item'
            style={{
                ...style,
                backgroundColor: index % 2 === 0 ? 'burlywood': 'cadetblue'
            }}
            >
                {index}
        </div>
    )
}
function App() {
    // const d = new Date();
    const list = new Array(10000).fill(0).map((item, i) => i)
    // console.log(+new Date(), +d)
    return (
        <div>
            列表高度固定 - 虚拟列表实现
            <FixedSizeList
                containerHeight = {300}
                itemHeight = {50}
                itemCount = {list.length}
                
            >
                {Item}
            </FixedSizeList>
        </div>
    )
}

export default App